package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Userid   int    `gorm:"type:char(20);not null; comment:'用户编号'"`
	Realname string `gorm:"type:varchar(20);not null; comment:'身份证姓名'"`
	Idcard   string `gorm:"type:varchar(20);not null; comment:'身份证编号'"`
}

func (r *User) TableName(userid int, idcard string) error {
	return DB.Where("userid = ? or idcard = ?", userid, idcard).Limit(1).First(&r).Error
}
func (r *User) Create() error {
	return DB.Create(r).Error
}
